#pragma once

#include <vector>
#include <algorithm>
#include <list>
#include "DX11Includes.h"
#include "Updateable.h"

using namespace std;

///PORRA DE DEPENDENCIA CIRCULAR >.<
///em c# isto non ecxiste
class EngineStuff; 
class IHudElement;

class IScreen
{
public:
	IScreen(void);
	~IScreen(void);
	virtual void Init(EngineStuff* engine) = 0;
	virtual void Release() = 0;
	virtual void Update(DWORD ElapsedTime);
	virtual void Draw(DWORD ElapsedTime);
	bool updateWhenNotCurrentScreen;
	void AddHudElement(IHudElement* element){ elements.push_back(element);}
	void RemoveElement(IHudElement* element){ elements.remove(element); }
	void AddUpdateable(Updateable* upt) { updateables.push_back(upt); }
	void RemoveUpdateable(Updateable* upt) { updateables.remove(upt); }

protected:
	list<IHudElement*> elements;
	list<Updateable*> updateables;
};

class ScreenManager
{
public:
	ScreenManager(EngineStuff* engine );
	~ScreenManager(void);
	void AddScreen(IScreen* screen);
	void ActiveScreen(IScreen* screen);
	void RemoveScreen(IScreen* screen);
	void Update(DWORD elapsedTime);
	void Draw(DWORD elapsedTime);

private:	
	IScreen* currentScreen;
	vector<IScreen*> screens;
	EngineStuff* engine;	

};

